﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace WebApplication6
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        private void MessageBox(string msg)
        {
            Label lbl = new Label();
            lbl.Text = "<script language='javascript'>" + Environment.NewLine + "window.alert('" + msg + "')</script>";
            Page.Controls.Add(lbl);
        }


        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FormsAuthentication.Authenticate(textboxLogin.Text, textboxHaslo.Text))
            {
                FormsAuthentication.RedirectFromLoginPage(textboxLogin.Text, true);
            }
            else
            {
                MessageBox("Niepoprawny login lub hasło:");
            }
        }
    }
}